// 使用接口约束TS函数
{
  interface UserInterface {
    name: string,
    age: number,
    isLock: boolean
  }

  const user: UserInterface = {
    name: 'zrf',
    age: 123,
    isLock: false
  }

  function handleLock(user: UserInterface, lock: boolean): UserInterface {
    user.isLock = lock
    return user
  }

  // 类中使用接口
  class User {
    private _info: UserInterface
    public constructor(user: UserInterface) {
      this._info = user
    }
    // 因为使用了访问器 编译时加上-t es5
    get info(): UserInterface {
      return this._info
    }
  }
  let zrf = new User({
    name: 'zrf',
    age: 18,
    isLock: false
  })
  console.log(zrf.info);

}